<template>
  <div class="icons">
    <div class="swiper">
      <div class="swiper-slide">
        <div class="icon" v-for="(title, index) in titles" :key="index" @click="itemClick(index)">
          <div class="icon-img">
            <img class="icon-img-content" :src="'http://'+title.img" />
            <p class="icon-desc">{{ title.category_name }}</p>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "HomeIcons",
  props: {
    titles: Array,
  },
  data() {
    return {};
  },
  methods: {
    itemClick (index) {
      this.$emit('tabClick',index)
    }
  }
};
</script>

<style lang="less" scoped>
.icons {
  height: 0.84rem;
  margin: 0 0.1rem 0.1rem 0.1rem;
  background: #eee;
  .swiper {
    .swiper-slide {
      display: flex;
      height: 0.849rem;
      background: #fff;
      justify-content: space-around;
      align-items: center;
      .icon {
        .icon-img {
          .icon-img-content {
            display: inline-block;
            width: 0.25rem;
            height: 0.28rem;
          }
        }
        .icon-desc {
          margin-top: 0.14rem;
          font-size: 0.12rem;
          color: #333;
        }
      }
    }
  }
}
</style>
